ScStub, Group, Trigger
----------------------

Trigger processing is done by at routine at address 00403230.
The call to the exported trigger function from the DLL is made at address 00403294.

The game processes a linked list of triggers. The address of the first trigger can be found at [004E9E9C]. The size of each node appears to be 0x40.



ScStub
------
size: 0x14
------
0x0	4	vtbl
0x4	4	int scStubIndex		[ScStub.ID]
0x8	4	int enableStatus	[0 = Disabled, 1 = Enabled, 2 = ?]
0xC		
0x10		
------



ScStub:Trigger
--------------
Size: 0x28
--------------
0xC 	 	?Pointer to ExportedFunction info (name, address, etc.)
0x10 	 	?Pointer to ExportedFunction info (name, address, etc.)
0x14 	4 	Trigger* previous
0x18 	4 	Trigger* next
0x1C 	 	boolNoRepeat
0x20 	 	boolVectorHasFired (0 bit if not fired for player)
0x24 	 	ScStub:FunctionReference* callback
--------------



ScStub:Trigger:Attacked
-----------------------
Size: 0x34
-----------------------
0x30		
-----------------------


ScStub:Trigger:BuildingCount
----------------------------
Size: 0x3C
----------------------------
0x30	4	int refValue
0x34	4	int playerNum
0x38	4	compare_mode compareMode
----------------------------


ScStub:Trigger:Count
--------------------
Size: 0x44
--------------------
0x30		
0x34		
0x38		
0x3C		
0x40		
--------------------


ScStub:Trigger:Damaged
----------------------
Size: 0x38
----------------------
0x30		
0x34		
----------------------


ScStub:Trigger:Escape
---------------------
Size: 0x54
---------------------
0x30		
...
---------------------


ScStub:Trigger:Evac
-------------------
Size: 0x34
-------------------
0x30		
-------------------


ScStub:Trigger:FailureCondition
-------------------------------
Size: 0x38
-------------------------------
0x30		
0x34		
-------------------------------


ScStub:Trigger:Kit
------------------
Size: 0x3C
------------------
0x30		
0x34		
0x38		
------------------


ScStub:Trigger:Midas
--------------------
Size: 0x38
--------------------
0x30		
0x34		
--------------------


ScStub:Trigger:OnePlayerLeft
----------------------------
Size: 0x30
----------------------------
[Intentionally left blank]
----------------------------


ScStub:Trigger:Operational
--------------------------
Size: 0x40
--------------------------
0x30	4	map_id buildingType
0x34	4	int refValue
0x38	4	int playerNum
0x3C	4	compare_mode compareMode
--------------------------


ScStub:Trigger:Point
--------------------
Size: 0x3C
--------------------
0x30	4	int pixelX
0x34	4	int pixelY
0x38	4	int playerBitVector
--------------------


ScStub:Trigger:Rect
-------------------
Size: 0x44
-------------------
0x30		
0x34		
0x38		
0x3C		
0x40		
-------------------


ScStub:Trigger:Research
-----------------------
Size: 0x38
-----------------------
0x30	4	int techID
0x34		
-----------------------


ScStub:Trigger:Resource
-----------------------
Size: 0x40
-----------------------
0x30		
0x34		
0x38		
0x3C		
-----------------------


ScStub:Trigger:Set
------------------
Size: 0x58
------------------
0x30
...
------------------


ScStub:Trigger:SpecialTarget
----------------------------
Size: 0x40
----------------------------
0x30	4	int targetUnitIndex	[Target Unit]	[Lab]
0x34	4	int sourceUnitIndex	[Source Unit]	[Scout]
0x38	4	map_id sourceUnitType	[mapScout]
0x3C	4	bool boolHasFired
----------------------------


ScStub:Trigger:Time
-------------------
Size: 0x38
-------------------
0x30	4	int time
0x34	4	int timeLeft
-------------------


ScStub:Trigger:VehicleCount
---------------------------
Size: 0x3C
---------------------------
0x30		
0x34		
0x38		
---------------------------


ScStub:Trigger:VictoryCondition
-------------------------------
Size: 0x38
-------------------------------
0x30	4	char* missionObjective
0x34	4	int victoryConditionScStubIndex
-------------------------------


Trigger vtbl
------------
11 Entries.

Offset 	Address 	Description
------ 	------- 	-----------
0x0 	00492730 	ScStub* Release(int bDelSelf)
0x4 	00492720 	ScStubCreator* GetScStubCreator()
0x8 	004920A0 	void ???()	[Set enabledState = 2]
0xC 	00424A30 	void Enable()
0x10 	00424A40 	void Disable()
0x14 	00492860 	int Save(StreamIO* savedGameFile)
0x18 	004928E0 	int Load(StreamIO* savedGameFile)
0x1C 	00491FF0 	void Destroy()
0x20 	00491F90 	
0x24 	004927D0 	bool HasFired()
0x28 	00491E70 	void* GetCallbackFunctionAddress()




ScStub:ScriptDataBlock
----------------------
Size: 0x28
----------------------
0x14		
0x18		
0x1C		
0x20		
0x24		
----------------------


ScStub:FunctionReference
------------------------
Size: 0x30
------------------------
0x14 	 	
0x18 	 	
0x1C 	 	
0x20 	 	Pointer to Trigger name (ASCII)
0x24 	 	Pointer to Trigger function
0x28 	 	
0x2C 	 	
------------------------


ScStub:FunctionReference.vtbl
-----------------------------
8 (9?) Entries.
Note: Some addresses at matching offsets are shared by the Trigger class. This would suggest they are part of the same class hierarchy.

Offset 	Address 	Description
------ 	------- 	-----------
0x0 	00475870 	
0x4 	00475860 	
0x8 	004756D0 	
0xC 	00424A30 	Enable
0x10 	00424A40 	Disable
0x14 	004756E0 	
0x18 	00475750 	
0x1C 	00424A50 	?Destroy?
0x20 	0047B620 	



ScStub:Group
------------
Size: 0x300
------------
0x14		
0x18		
0x1C	4	
0x20	4	
0x24		

0x2A4	0x40	
0x2E4	4	
0x2E8	4	
0x2EC	4	
0x2F0	4	int 
0x2F4	4	int ownerPlayerNum
0x2F8	4	
0x2FC	4	
------------


ScStub:Group:BuildGroup
-----------------------
Size: 0x35C
-----------------------


ScStub:Group:CombatBase
-----------------------
Size: 0x3E8
-----------------------
0x300		
0x304		
0x308	0xE0	CombatBaseInfo
 ...
 0x33C	 4	 
 0x340	 4	 
 0x344	 	 
 0x348	 4	 
 0x34C	 	 
 0x350	 	 
 0x354	 4	 
 0x358	 4	 
 0x35C	 4	 
 0x360	 4	 
 ...
-----------------------


ScStub:Group:MineGroup
----------------------
Size: 0x338
----------------------
0x300		
0x304		
0x308	0x30	MineGroupInfo
 0x308	 4	 int mineUnitIndex
 0x30C	 4	 int smelterUnitIndex
 0x310	 8	 Point minePixelLocation
  0x310	  4	  int minePixelX
  0x314	  4	  int minePixelY
 0x318	 8	 Point smelterPixelLocation
  0x318	  4	  int smelterPixelX
  0x31C	  4	  int smelterPixelY
 0x320	 4	 map_id mineType
 0x324	 4	 map_id smelterType
 0x328	 0x10	 Rect mineGroupPixelRect
  0x328	  4	  int x1
  0x32C	  4	  int y1
  0x330	  4	  int x2
  0x334	  4	  int y2
----------------------




ScStub:Strategy
---------------
Size: 0x1C
---------------
0x14		
0x18		
---------------


ScStub:Strategy:PinwheelAttack
------------------------------
Size: 0x9C
------------------------------
0x1C		
0x20		
0x24	4	
0x28	4	???* attackComp
0x2C	4	???* guardComp
0x30	4	???* sapperComp
0x34	4	
0x38	4	
0x3C		
0x40		
0x44	4	int contactDelay
0x48	4	
0x4C	4	int attackTime		[tick]
0x50	4	
0x54	4	int maxAttackTime	[min period between attacks]
0x58	4	int minAttackTime	[max period between attacks]
0x5C	4	
0x60	4	

0x64	?	
 0x64	 4	 
 0x68	 4	 
0x74	?	
 0x74	 4	 
 0x78	 4	 
0x84	?	
 0x84	 4	 
 0x88	 4	 

0x94	4	int attackFraction
0x98	4	
------------------------------


